<template>
  <!-- <el-space wrap :size="props.params.eltagSize">
    <div>
      <el-tag :type="props.params.styleClass(props.params.data)">{{
        props.params.text(props.params.data)
      }}</el-tag>
    </div>
  </el-space> -->
  <el-select
    v-model="selectValue"
    class="m-2"
    placeholder="请选择"
    size="small"
    ref="selectRef"
    @change="selectChange"
    style="width: 100%; height: 100%"
  >
    <el-option
      v-for="item in props.params.list"
      :key="item.value"
      :label="item.label"
      :value="item.value"
    />
  </el-select>
</template>

<script setup lang="ts">
  import { valueEquals } from 'element-plus'

  const props = withDefaults(
    defineProps<{
      params: any
    }>(),
    {
      params: {},
    }
  )
  const selectRef = ref('')
  const selectValue = ref('')
  onMounted(() => {
    // console.log(props.params.getRowData())
    selectValue.value = props.params.data.scrapWay
  })
  const selectChange = (data: any) => {
    selectValue.value = data
    props.params.data[props.params.key] = data
    props.params?.setValue(data)
    props.params?.changeData(props.params.data)
    // props.params.refreshCell()
    // .refreshCell()
    // console.log(props.params)
    // props.params.stopEditing()
  }
</script>
